@echo off

SET DBMS_SERVER=.
SET CONNECTION_OPTIONS=-E
SET STAGING_DATABASE_NAME=EducationSystem

if exist ..\setConnectivity.cmd (
	call ..\setConnectivity.cmd
)

sqlcmd -S %DBMS_SERVER% %CONNECTION_OPTIONS% -b -d %STAGING_DATABASE_NAME% -i kill_all_connections.sql -v STAGING_DATABASE_NAME="%STAGING_DATABASE_NAME%" || goto FAIL

goto SUCCESS
:FAIL
echo ERROR OCCURED. Press any key to exit...
pause >nul
goto EOF
:SUCCESS
pause